package com.globallogic.strelchuk.multi.entity;

import com.globallogic.strelchuk.multi.exception.TableSizeException;

/**
 * @author olena.strelchuk
 */

/**
 * Entity of Multiplication Table for specified number
 */
public abstract class AbstractMultiplicationTable {

	private static final int MAX_TABLE_SIZE = 9;
	private static final int MIN_TABLE_SIZE = 1;

	private int tableSize;

	/**
	 * Create MultiplicationTable entity
	 * 
	 * @throws TableSizeException
	 *             if table size is not between 1 and 9
	 */
	public AbstractMultiplicationTable(int tableSize) throws TableSizeException {
		this.tableSize = tableSize;

		if ((tableSize < MIN_TABLE_SIZE) || (tableSize > MAX_TABLE_SIZE)) {
			throw new TableSizeException(tableSize);
		}
		
		initTable();
	}

	public void initTable() {
		
	}
	
	public int getTableSize() {
		return tableSize;
	}
}

